package org.javaboy.account.controller;

import io.seata.rm.tcc.api.BusinessActionContext;
import org.javaboy.account.service.AccountService;
import org.javaboy.api.AccountServiceApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.Objects;

@RestController
public class AccountController implements AccountServiceApi {

    @Autowired
    AccountService accountService;

    @Override
    public boolean deduceAccount(BusinessActionContext actionContext, Integer userId, Double money) {
        return accountService.deduce(userId, money);
    }

    @Override
    public boolean commit(BusinessActionContext actionContext) {
        return accountService.commit(actionContext);
    }

    @Override
    public boolean rollback(BusinessActionContext actionContext) {
        return accountService.rollback(actionContext);
    }
}
